import { http } from "@/utils/http/axios";
/**
 * 获取消息
 * @returns
 */
export function getPageList(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: "/system/notify/page",
			method: "get",
			params
		},
		{
			isTransformResponse: false
		}
	);
}

export function getTemplate(id: number) {
	return http.request<API.Response.BasicResponse>({
		url: `system/notify/${id}`,
		method: "GET"
	});
}

export function save(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `/system/notify`,
			method: "POST",
			params: params
		},
		{
			isTransformResponse: true
		}
	);
}

export function update(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `/system/notify`,
			method: "PUT",
			params: params
		},
		{
			isTransformResponse: true
		}
	);
}

/**
 * 删除公告消息
 * @param ids 角色ID
 * @returns
 */
export function remove(ids: number | Array<number>) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `/system/message/${ids}`,
			method: "DELETE"
		},
		{
			isTransformResponse: true
		}
	);
}
